<template>
  <div>
    <div class='banner' @click='handleBannerClick'>
      <img class='banner-img' :src="bannerImg" />
      <div class='banner-info'>
        <div class='banner-title'>{{ sightName }}</div>
        <div class='banner-number'><span class='iconfont banner-icon'>&#xe626;</span>10</div>
      </div>
    </div>
    <fade-animation>
      <common-gallary :imgs='imgs' v-show='showGallary' @close='closeBannerGallary'></common-gallary>
    </fade-animation>
  </div>
</template>
<script>
import CommonGallary from '@/pages/common/gallary/Gallary'
import FadeAnimation from '@/pages/common/fadeanimation/FadeAnimation'
export default {
  name: 'DetailBanner',
  props: {
    sightName: String,
    bannerImg: String,
    imgs: Array
  },
  components: {
    CommonGallary,
    FadeAnimation
  },
  data () {
    return {
      showGallary: false
    }
  },
  methods: {
    handleBannerClick () {
      this.showGallary = true
    },
    closeBannerGallary () {
      this.showGallary = false
    }
  }
}

</script>
<style lang='stylus' scoped>
.banner {
  position: relative;
  overflow: hidden;
  height: 0;
  padding-bottom: 55%;
}

.banner-img {
  width: 100%;
}

.banner-info {
  display: flex;
  position: absolute;
  height: .7rem;
  line-height: .7rem;
  bottom: 0;
  left: 0;
  right: 0;
  padding-left: .15rem;
  color: #fff;
  font-size: .36rem;
  background-image: linear-gradient(top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.8));
}

.banner-title {
  flex: 1;
}

.banner-number {
  padding: 0 .3rem;
  height: .4rem;
  line-height: .4rem;
  border-radius: .4rem;
  margin-top: .15rem;
  background: rgba(0, 0, 0, 0.7);
  margin-right: .4rem;
  font-size: .24rem;
}

.banner-icon {
  font-size: .24rem;
}

</style>
